package com.boyiis.sell.service.impl;

import com.boyiis.sell.model.entity.ProductCategory;
import com.boyiis.sell.model.entity.mapper.ProductCategoryMapper;
import com.boyiis.sell.repository.ProductCategoryRepository;
import com.boyiis.sell.service.ProductCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Service
@Transactional
@Slf4j
public class ProductCategoryServiceImpl implements ProductCategoryService {

    @Autowired
    private ProductCategoryRepository productCategoryRepo;

    @Autowired
    private ProductCategoryMapper mapper;

    @Override
    public ProductCategory findOne(Integer categoryId) {
        return productCategoryRepo.findOne(categoryId);
    }

    @Override
    public List<ProductCategory> findAll() {
        return productCategoryRepo.findAll();
    }

    @Override
    public List<ProductCategory> findByCategoryTypeIn(List<Integer> categoryTypeList) {
        return productCategoryRepo.findByCategoryTypeIn(categoryTypeList);
    }

    @Override
    public ProductCategory save(ProductCategory productCategory) {
        return productCategoryRepo.save(productCategory);
    }
}
